<template>
	<view class="back_f" v-if="dataList.length > 0">
		<view class="title">推荐产品</view>
		<recom-list :dataList="dataList" :isBuy="true"></recom-list>
	</view>
</template>

<script>
import { pagingMixin } from '@/mixins/pagingMixin.js';
import recomList from '../recom-list/index.vue';
export default {
	mixins: [pagingMixin],
	props: {
		userId: {
			type: Number,
			default: null
		}
	},
	components: {
		'recom-list': recomList
	},
	data() {
		return {
			
		};
	},

	mounted() {
		let params = {
			users_id: this.userId,
		};
		this._init_data('GetUsersFavouriteList', params,{callBack:this.getter});
	},

	methods: {
		$onReachBottom() {
			this._load_data({callBack:this.getter});
		},
		getter (list) {
			return list.map((item)=>{
				return {
					...item,
					product_img:item.product_img ? item.product_img.split(',')[0] : ''
				}
			})
		}
	}
};
</script>

<style scoped lang="scss">
	.title{
		padding: 20rpx 24rpx;
		font-weight: bold;
		font-size: 30rpx;
	}
	.back_f{
		position: relative;
		z-index: 10; // 兼容模板一的那个定位
		background-color: #fff;
	}
</style>
